package com.uxhao.vod.util;

import com.uxhao.commonutils.util.YamlAndPropertySourceFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 上传视频常量类
 * @author uxhao
 * @date 2021/1/16 9:27
 */
@Component
@PropertySource(value = {"classpath:dev-key.yml"},factory = YamlAndPropertySourceFactory.class)
public class ConstantVodUtils implements InitializingBean {

    @Value("${aliyun.vod.file.keyid}")
    String keyId;

    @Value("${aliyun.vod.file.keysecret}")
    String keySecret;

    @Value("${aliyun.vod.file.apiRegionId}")
    String apiRegionId;

    @Value("${aliyun.vod.file.storageLocation}")
    String storageLocation;

    //定义公开静态常量
    public static String ACCESS_KEY_SECRET;
    public static String ACCESS_KEY_ID;
    public static String APIREGIONID;
    public static String STORAGELOCATION;

    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEY_SECRET = keySecret;
        ACCESS_KEY_ID = keyId;
        APIREGIONID=apiRegionId;
        STORAGELOCATION=storageLocation;
    }
}
